package com.zhoug.demo.player.http;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author: zhoug
 * @since: 2025-06-20
 */
public class DataManager {
    public static final int SERVER_NAN_NING = 1;//南宁
    public static final int SERVER_KYQQ = 2;//科右前旗
    public static final int SERVER_GUI_ZHONG = 3;//桂中大药房
    public static final int SERVER_mclz3 = 4;//明厨亮灶3.0汇聚平台
    public static final int SERVER_NMG = 5;//内蒙古平台

    private static final String TOKEN = "TOKEN";
    private static String BASE_URL = "http://36.134.87.77:9015/";
    private static int serverType;
    private static SharedPreferences mSP;

    public static void init(Application application) {
        mSP = application.getSharedPreferences("default", Context.MODE_PRIVATE);
    }

    public static void setToken(String token) {
        mSP.edit().putString(TOKEN, token).apply();
        ;
    }

    public static String getToken() {
        return mSP.getString(TOKEN, null);
    }

    public static void setBaseUrl(String baseUrl) {
        BASE_URL = baseUrl;
    }

    public static void setServerType(int serverType) {
        DataManager.serverType = serverType;
    }

    public static int getServerType() {
        return serverType;
    }

    public static String getBaseUrl() {
        return BASE_URL;
    }

    public static String getApiV1() {
        return BASE_URL + "v1/";
    }

}
